home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2.sit
/
Raven 1.2
/
Source
/
Foundation
/
OS
/
ZInterruptTimer.h
< prev
next >
Wrap
Text File
|
1997-04-13
|
3KB
|
136 lines
/*
* File: ZInterruptTimer.h
* Summary: Interrupt driven timer classes
* Written by: Jesse Jones
*
* Copyright ゥ 1996-1997 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <2> 4/13/97 JDJ MTimeMgrTimer descends from MExitAction instead of
* using an ExitToShell patch.
* <1> 6/23/96 JDJ Created
*/
#pragma once
#include <Retrace.h>
#include <Timer.h>
#include <ZBaseTimer.h>
#include <ZExitAction.h>
// ===================================================================================
// class MVBLTimer
// ===================================================================================
class MVBLTimer : public MBaseTimer {
typedef MBaseTimer Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~MVBLTimer();
explicit MVBLTimer(MilliSecond freq, bool running = false);
// Frequency is the interval at which the timer wants to be called.
//-----------------------------------
// Inherited API
//
public:
virtual void StopTimer();
virtual void StartTimer();
virtual void SetTimerFreq(MilliSecond freq);
//-----------------------------------
// Internal API
//
protected:
void InstallTimer();
void RemoveTimer();
static pascal void OnInterrupt(VBLTaskPtr taskPtr);
//-----------------------------------
// Data members
//
protected:
struct SVBLRecord {
VBLTask task;
long myA5;
MVBLTimer* thisPtr;
short vblFreq;
bool inTask;
};
SVBLRecord mVBLInfo; // Data accessed from within the VBL task.
bool mTimerInstalled;
};
// ===================================================================================
// class MTimeMgrTimer
// ===================================================================================
class MTimeMgrTimer : public MBaseTimer, public MExitAction {
typedef MBaseTimer Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~MTimeMgrTimer();
explicit MTimeMgrTimer(MilliSecond freq, bool running = false);
// Frequency is the interval at which the timer wants to be called.
//-----------------------------------
// MBaseTimer API
//
public:
virtual void StopTimer();
virtual void StartTimer();
virtual void SetTimerFreq(MilliSecond freq);
//-----------------------------------
// MExitAction API
//
protected:
virtual void OnAbnormalExit();
//-----------------------------------
// Internal API
//
protected:
void InstallTimer();
void RemoveTimer();
static pascal void OnInterrupt(TMTask* taskPtr);
//-----------------------------------
// Data members
//
protected:
struct STimeMgrRecord {
TMTask task;
long mMyA5;
MTimeMgrTimer* thisPtr;
bool inTask;
};
STimeMgrRecord mTimeMgrInfo; // Data accessed from within the time manager task.
bool mTimerInstalled;
};